package com.candy.lianxi.diliuzhang.app_value;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class AppValueMapper extends Mapper<LongWritable, Text, Text, App> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, App>.Context context) throws IOException, InterruptedException {
        String line=value.toString();
        String[] words=line.split(",");
        App app=new App();
        app.setCount(Integer.parseInt(words[3]));
        app.setTime(Integer.parseInt(words[4]));
        app.setConsume(Integer.parseInt(words[5]));
        context.write(new Text(words[2]),app);
    }
}
